package com.ruoyi.common.utils;

import java.text.SimpleDateFormat;

public class SequenceUtils {

    static final int DEFAULT_LENGTH = 5;
    public static String getSequence(long seq) {
        String str = String.valueOf(seq);
        int len = str.length();
        if (len >= DEFAULT_LENGTH) {// 取决于业务规模,应该不会到达4
            return str;
        }
        int rest = DEFAULT_LENGTH - len;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < rest; i++) {
            sb.append('0');
        }
        sb.append(str);
        return sb.toString();
    }
    /**
     * 得到系统当前日期
     * "yyyyMMdd"
     */
    public static String getCurentDate() {
        SimpleDateFormat tempDate = new SimpleDateFormat("yyyyMMdd");
        String datetime = tempDate.format(new java.util.Date());
        return datetime;
    }
}
